'use strict';
module.exports = app => {
  const { ENUM, INTEGER, STRING } = app.Sequelize;
  // 商品
  const Withdrawal = app.model.define('withdrawal', {
    // 提现人姓名
    name: { type: STRING, allowNull: false },
    // 提现人电话
    phone: STRING(11),
    // 提现金额
    price: { type: INTEGER, allowNull: false },
    // 提现状态
    status: {
      type: ENUM,
      values: [ 'success', 'loading' ],
      defaultValue: 'loading',
      allowNull: false,
    },
    // 支付宝姓名
    alipayName: STRING,
    // 支付宝账户
    alipayAccount: STRING,
    // 排序
    order: INTEGER,
  });
  Withdrawal.associate = function() {
    // 微信用户
    Withdrawal.belongsTo(app.model.WechatAccount);
  };

  return Withdrawal;
};
